﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DLLCOM;
namespace DLLCOM
{
    class ComHelper
    {
        public static string Add(string guid, string connectionStr, int a, int b)
        {
            string ret = "";
            Type dycomType = Type.GetTypeFromCLSID(new Guid(guid));

            if (dycomType != null)
            {
                //创建类实例
                dynamic dycomObject = Activator.CreateInstance(dycomType);
                //调用
                ret = dycomObject?.Add(a, b);
            }

            return ret;
        }

        public static string Multi(string guid, string connectionStr, int a, int b)
        {
            string ret = "";
            Type dycomType = Type.GetTypeFromCLSID(new Guid(guid));

            if (dycomType != null)
            {
                //创建类实例
                dynamic dycomObject = Activator.CreateInstance(dycomType);
                //调用
                ret = dycomObject?.Multi(a, b);
            }

            return ret;
        }
        public static string Factorial(string guid, string connectionStr, int a)
        {
            string ret = "";
            Type dycomType = Type.GetTypeFromCLSID(new Guid(guid));

            if (dycomType != null)
            {
                //创建类实例
                dynamic dycomObject = Activator.CreateInstance(dycomType);
                //调用
                ret = dycomObject?.Factorial(a);
            }

            return ret;
        }
    }
}
